function Builder() {
    this.dataList = [];
}

Builder.prototype.leftPad = function(val, size, ch) {
    var result = val;
    if(!ch) {
        ch = " ";
    }
    var i = 0;
    while (i < size) {
        i++;
        result = ch + result;
    }
    return result;
}

Builder.prototype.toString = function() {
    return this.dataList.join('\n');
}

Builder.prototype.toArray = function() {
    return this.dataList;
}

Builder.prototype.appendLastLine = function(data, deep) {
    if (data === undefined) {
        return;
    }
    if (this.dataList.length <= 0) {
        this.push('', deep);
    }
    if (!this.dataList[this.dataList.length - 1]) {
        this.dataList[this.dataList.length - 1] = "";
    }
    this.dataList[this.dataList.length - 1] += data;
    //console.log(this.dataList);
}

Builder.prototype.push = function(data, deep) {
    var d = deep || 0;
    if (data === undefined) {
        return;
    }
    this.dataList.push(this.leftPad(data, d * 4, ' '));
    //console.log(this.dataList);
}